#ifndef YAAL_MSVCXX_CSIGNAL_INCLUDED
#define YAAL_MSVCXX_CSIGNAL_INCLUDED 1

#include <../include/csignal>
#ifdef __YAAL_BUILD__
#define _INC_MATH
#include <process.h>
#include <pthread.h>
#include "cleanup.hxx"
#else
#include <yaal/cleanup.hxx>
#endif

static int const UNIX_SIGINT = 2;
static int const UNIX_SIGILL = 4;
static int const UNIX_SIGABRT = 6;
static int const UNIX_SIGFPE = 8;
static int const UNIX_SIGSEGV = 11;
static int const UNIX_SIGTERM = 15;

static int const SA_RESTART = 0x2;

static int const SIGHUP = 1;
static_assert( SIGINT == UNIX_SIGINT, "bad SIGINT value" );
static int const SIGQUIT = 3;
static_assert( SIGILL == UNIX_SIGILL, "bad SIGILL value" );
static int const SIGTRAP = 5;
static_assert( ( SIGABRT == UNIX_SIGABRT ) || ( SIGABRT_COMPAT == UNIX_SIGABRT ), "bad SIGABRT value" );
static int const SIGIOT = 6;
static_assert( SIGFPE == UNIX_SIGFPE, "bad SIGFPE value" );
static int const SIGKILL = 9;
static int const SIGBUS = 10;
static_assert( SIGSEGV == UNIX_SIGSEGV, "bad SIGSEGV value" );
static int const SIGSYS = 12;
static int const SIGPIPE = 13;
static int const SIGALRM = 14;
static_assert( SIGTERM == UNIX_SIGTERM, "bad SIGTERM value" );
static int const SIGURG = 16;
static int const SIGSTOP = 17;
static int const SIGTSTP = 18;
static int const SIGCONT = 19;
static int const SIGTTIN = 21;
static int const SIGTTOU = 22;
static int const SIGCHLD = 25;
static int const SIGWINCH = 28;
static int const SIGPWR = 29;
static int const SIGUSR1 = 30;

typedef void (*sighandler_t) (int);

typedef int long long unsigned sigset_t;

struct sigaction {
	sighandler_t sa_handler;
	sigset_t sa_mask;
	int sa_flags;
};

int sigaddset( sigset_t*, int );
int sigdelset( sigset_t*, int );
int sigpending( sigset_t* );
int sigismember( sigset_t const*, int );
int sigwait( sigset_t*, int* );
int sigaction( int, struct sigaction*, void* );
int sigemptyset( sigset_t* );
int sigfillset( sigset_t* );
int kill( int, int );
int pthread_sigmask( int, sigset_t const*, sigset_t* );
int sigprocmask( int, sigset_t const*, sigset_t* );
char const* strsignal( int );

#endif /* not YAAL_MSVCXX_CSIGNAL_INCLUDED */
// vim: ft=cpp
